//
//  TTKUtil.h
//  AQUA
//
//  Created by 吕清毅 on 2018/8/1.
//  Copyright © 2018年 小河. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface TTKUtil : NSObject

/**
 获取AppDelegate
 */
+ (AppDelegate *)getAppDelegate;

+ (MBProgressHUD *)createMbprogressHudWith:(UIViewController *)VC;

//弹出框
+ (void)hudShowMessage:(NSString *)message;

//字符串替换
+ (NSString *)stringReplaceWith:(NSString *)str;

//获取系统当前语言
+ (NSString *)getCurrentLanguage;

//获取当前的日期
+ (NSString *)getToday;

//获取下标3之前的字母
+ (NSString *)getSubToString:(NSString *)str andIndex:(int)index;

//获取下标4之后的字母
+ (NSString *)getSubFromString:(NSString *)str andIndex:(int)index;

/**
 消除tableView黑边
*/
 + (void)setAutomaticallyAdjustsScrollViewInsetsWidth:(UITableView *)tableView withView:(UIViewController *)view;

/**
 view的渐变色
 */
+ (void)setCAGradientLayer:(UIView *)view From:(UIColor *)fromColor To:(UIColor *)toColor;

/**
 背景变灰色
 */
+ (UIImage *)becomeGrayColorWith:(UIColor *)color;

/**
 图片压缩
 */
+ (UIImage *)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize;

/**
 当前语言
 */
+ (NSString *)nowLanguage;

+ (NSString *)getCurrentTime;

/*
 *  设置行间距和字间距
 *
 *  @param lineSpace 行间距
 *  @param kern      字间距
 *
 *  @return 富文本
 */
+(NSAttributedString*)getAtttributeStringWithLineSpace:(CGFloat)lineSpace kern:(CGFloat)kern and:(NSString *)title;

+(NSAttributedString*)getAtttributeStringColorWithLineSpace:(CGFloat)lineSpace kern:(CGFloat)kern and:(NSString *)title;

+(NSAttributedString*)getAtttributeStringWithLineSpace:(CGFloat)lineSpace kern:(CGFloat)kern and:(NSString *)title andColor:(UIColor *)color;
/*
 根据高度获取宽度
 */
+ (CGSize)sizeWithText:(NSString *)text Height:(CGFloat)height Font:(UIFont*)font;

/*
 根据宽度获取高度
 */
+ (CGSize)sizeWithText:(NSString *)text Width:(CGFloat)width Font:(UIFont*)font;

+ (BOOL)isNil:(id)str;

+ (void)alertControllerShowMsg:(NSString *)msg and:(UIViewController*)vc;

+(NSString*)encodeString:(NSString*)unencodedString;

/*
 是否t开启通知
 */
+ (BOOL)isOpenNotify;

//图片压缩
+ (UIImage *)imageWithOriginalImage:(UIImage *)image;

@end
